package net.atomarrow.test.config;

import net.atomarrow.configs.Config;
import net.atomarrow.configs.DbConfig;
import net.atomarrow.db.orm.IDomainControl;
import net.atomarrow.db.pool.DefaultDruidDataSource;
import net.atomarrow.db.pool.IDataSource;

import java.util.ArrayList;
import java.util.List;

public class ProjectConfig extends Config{

    @Override
    public boolean configDevMode() {
        return true;
    }

    @Override
    public List<String> configTxPrefix() {
        List<String> needTxPrefixs = new ArrayList<String>();
        needTxPrefixs.add("add");
        needTxPrefixs.add("del");
        needTxPrefixs.add("modify");
        needTxPrefixs.add("save");
        needTxPrefixs.add("update");
        needTxPrefixs.add("do");
        needTxPrefixs.add("execute");
        return needTxPrefixs;
    }

    @Override
    public IDataSource configDbPool() {
    	
//    	C3p0DataSource source = new C3p0DataSource("jdbc:mysql://localhost/atomarrow", "root", "root");
//    	source.set(1, 3, 5);
//    	soruce.start();
//      return soruce.getDataSource();
    	
    	DefaultDruidDataSource soruce = new DefaultDruidDataSource("jdbc:mysql://localhost/test", "root", "root");
    	soruce.set(1, 3, 5);
    	soruce.start();
        return soruce;
    }

    @Override
    public String configDbName() {
        return "test";
    }

    @Override
    public String configDbType() {
        return DbConfig.DB_TYPE_MYSQL;
//        return DbConfig.DB_TYPE_ORACLE;
    }

    @Override
    public boolean configServiceLog() {
        return true;
    }
    
    @Override
    public boolean configStartLog() {
        return false;
    }


    @Override
    public String configUploadPath() {
        return "/upload";
    }

    @Override
    public int configUploadMaxSize() {
        return 1024*1024*5;
    }

    @Override
    public List<String> configUploadExcludeSuffixs() {
        List<String> excludeSuffixs=new ArrayList<String>();
        excludeSuffixs.add(".bat");
        excludeSuffixs.add(".exe");
        excludeSuffixs.add(".jsp");
        return excludeSuffixs;
    }

	@Override
	public void configOrmBean() {
//		OrmContext.addBean(clazz);
	}

	@Override
	public IDomainControl configDomainControl() {
		return null;
	}
	
	

}
